<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>驴妈妈统计系统</title>
<meta name="description" content="overview &amp; stats" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/loading-incr.css" />
<link rel="stylesheet"
	href="${request.contextPath}/static/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/jquery.gritter.min.css" />
<!-- text fonts -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/fonts.googleapis.com.css" />
<!-- ace styles -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace.min.css"
	class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-skins.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-rtl.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/stylesheets/daterangepicker.css">
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap-datepicker3.min.css">
<script src="${request.contextPath}/assets/js/jquery-2.1.4.min.js"></script>
<style type="text/css">
.upload{
    padding: 4px 10px;
    height: 34px;
    line-height: 38px;
    position: relative;
    border: 1px solid #D6487E;
    text-decoration: none;
    color: white;
}
.change{
    position: absolute;
    overflow: hidden;
    right: 0;
    top: 0;
    opacity: 0;
}
.txt{ height:34px; border:1px solid #cdcdcd; width:180px;}
.view{ background-color:#D6487E; border:1px solid #CDCDCD;height:34px; width:70px;color:white}

.file {
    position: absolute;
    top: 14px;
    right: 120px;
    height: 34px;
    filter: alpha(opacity:0);
    opacity: 0;
    width: 70px;
}
/* 模态框居中样式 */
 .modal-dialog {
 	top:10%;
 }
   .page-content{padding: 0px 0px 0px!important;}
  .ace-icon{cursor: pointer;}
  ::-webkit-scrollbar{ display: none;}
</style>
</head>
<body class="skin-2" style="background-color: #FFF;" id="loadingdiv">
	<div class="page-content">
		<div class="tabbable">
			<div class="tab-content">
			   <div id="manage" class="tab-pane active in">
					<div class="row">
						<div class="col-xs-12">
								<div class="widget-box">
									<div class="widget-body" style="background-color: #EFF3F8;">
										<div class="widget-main">
											<form class="form-inline" id="searchForm" method="POST" action="${request.contextPath}/match/ticket/commodity/list">
												<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<!-- 框架原因，所有post请求必须加这行代码 -->
												<div class="form-group" style="width: 100%;">
													<label for="exampleInputName2">监控平台
															<input class="form-control" name="companyCode" id="QueryByCompany" value="<#if companyCodeOfSearch??>${companyCodeOfSearch}</#if>" placeholder='产品ID' type="text" style="width:123px">
													</label>
													<label for="exampleInputName2" style="margin-left: 30px;">产品名称
															<input class="form-control" name="productName" id="QueryByProductName" value="<#if productNameOfSearch??>${productNameOfSearch}</#if>" placeholder="产品名称" type="text" style="width:123px">
													</label>
													<label for="exampleInputName2" style="margin-left: 30px;">商品ID
															<input class="form-control" name="commodityId" id="QueryByCommodityId" value="<#if commodityIdOfSearch??>${commodityIdOfSearch}</#if>" placeholder="商品ID" type="text" style="width:123px">
													</label>
													<label for="exampleInputName2" style="margin-left: 30px;">商品名称
															<input class="form-control" name="commodityName" id="QueryByCommodityName" value="<#if commodityNameOfSearch??>${commodityNameOfSearch}</#if>" placeholder="模糊查询商品ID" type="text" style="width:123px">
													</label>
													<button type="submit" class="btn btn-pink btn-sm" id="search">
															<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
															查询
													</button>
													<#if matchTicketCommodityList?? && matchTicketCommodityList?size&gt;0>
													<button type="button" class="btn btn-primary btn-sm" onclick="cleanRelevance();" >清除</button>
														<#else ><button type="button" class="btn btn-primary btn-sm" onclick="cleanRelevance();" disabled="disabled">清除</button>
													</#if>
													<label style="float: right;padding-right: 10px;cursor: pointer;">
														<!-- <span class="label label-lg label-yellow"  id="match" onclick="matchCommodity();">匹配</span> -->
														<!-- <span class="label label-lg label-success arrowed-right"  data-toggle="modal" data-target="#myModal03" id="newItem" onclick="addNewCommodityItem();">新增</span> -->
														<span class="label label-lg label-success arrowed-right" onclick="matchCommodity();">匹配</span>
														<span class="label label-lg label-yellow arrowed-in arrowed-in-right"  id="exportExcel">导出</span>
														<span class="label label-lg label-purple arrowed" data-toggle="modal" data-target="#myModalInput">导入</span>
													</label>
												</div>
											</form>
											<form action="${request.contextPath}/match/ticket/commodity/export" id="exportForm" method="post" hidden="true">
												<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<button type="submit" hidden="true" id="exportExcelForm" class="btn btn-primary" ></button>
											</form>
											<form action="${request.contextPath}/match/ticket/commodity/rel/listLmmCommodity" id="commodityLinkForm" method="post" hidden="true">
												<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<input type="hidden" id="commodityLinkID" name="id"  />
												<input type="hidden" id="lvmamaCommodityId" name="rsrvStr2"  />
												<input type="hidden" id="commodityLinkRealID" name="commodityId"  />
												<!-- 公司名称 -->
												<input type="hidden" id="companyCodeSearch" name="companyCode" />
												<input type="hidden" id="productNameSearch" name="productName" />
												<!-- 查询名称 -->
												<input type="hidden" id="preNameSearch" name="predealName"  />
												<input type="hidden" id="currentPage" name="rsrvStr1" value="${page.pageNum!}"  />
												<button type="submit" hidden="true" id="commodityLinkButton" class="btn btn-primary" ></button>
											</form>
										</div>
									</div>
								</div>
						</div>	
               			<div class="col-xs-12">
							<table id="dynamic-table" 
							class="table table-striped table-bordered table-hover dataTable no-footer" 
							role="grid" aria-describedby="dynamic-table_info">
								<thead>
									<tr>
										<th>监控编号</th>
										<th>监控平台</th>
										<th>监控景区</th>
										<th>商品编号</th>
										<th>商品名称</th>
										<th>价格</th>
										<th>驴妈妈商品ID</th>
										<th>驴妈妈商品名称</th>
										<th>驴妈妈商品价格</th>
										<th>操  作</th>
									</tr>
								</thead>
								<tbody>
								      	<#if matchTicketCommodityList?? && matchTicketCommodityList?size&gt;0> 
								      	<#list  matchTicketCommodityList as commodity>
										<tr>
											<td class="monitorId">${commodity.monitorId!}</td>
										    <td class="companyCode">${commodity.companyCode!}</td>
											<td class="productName">${commodity.productName!}</td>
										    <td class="commodityId">${commodity.commodityId!}</td>
											<td class="commodityName">${commodity.commodityName!}</td>
										    <td class="price">￥${commodity.price!}</td>
										    <td class="lvCommodityId">${commodity.lvCommodityId!}</td>
										    <td class="lvCommodityName">${commodity.lvCommodityName!}</td>
										    <td class="lmmPrice"><#if commodity.lmmPrice??>￥${commodity.lmmPrice!}</#if></td>
										    <!-- <td class="productUrl"><#if commodity.productUrl??&&commodity.productUrl?length&gt;5>${commodity.productUrl?substring(0,5)}...<a onclick="showDetailUrl(this);" ">查看更多</a><#elseif commodity.productUrl??>${commodity.productUrl}</#if></td> -->
											<td>
												<!-- <a class="green" onclick="updateMatchCommodity(this);" role="button" data-toggle="modal" data-target="#myModal03">
													<i class="ace-icon fa fa-pencil bigger-130"></i>
												</a>
												<a class="red" onclick="deleteCommodityItem(this);" role="button">
													<i class="ace-icon fa fa-trash-o bigger-130"></i>
												</a>
												<a class="blue" onclick="skipToLinkPage(this);" role="button">
													<i class="ace-icon fa fa-search-plus bigger-130"></i>
												</a> -->
												<a class="green" onclick="skipToLinkPage(this);" role="button">
													<i class="ace-icon fa fa-pencil bigger-130" title="编辑"></i>
												</a>
												<a class="green" onclick="noCommodityMatch(this);" role="button">
													<i class="glyphicon glyphicon-adjust bigger-130"  title="无关联"></i>
												</a>
												<input type="hidden" class="lvProductId" value="${commodity.lvProductId!}" />
												<input type="hidden" class="lvCommodityName" value="${commodity.lvCommodityName!}" />
												<input type="hidden" class="monitorId" value="${commodity.monitorId!}" />
												<input type="hidden" class="id" value="${commodity.id!}" />
												<input type="hidden" class="commodityName" value="${commodity.commodityName!}" />
												<input type="hidden" class="productUrl" value="${commodity.productUrl!}" />
											</td>
										</tr>
							    </#list>
							     
								</#if>
							</tbody>
							</table>
                           	<#include "/paginator.html">
                         </div>
                            		
					</div>
				</div>
			</div>
		</div>
	</div>  
	<div class="row">
		<div class="col-xs-12">
			<button class="btn btn-info" data-toggle="modal" type="button"
				style="display: none;" id="detailInfo" data-target="#myModal02">
			</button>
				<div class="modal fade" id="myModal02" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content" style="width:800px; height:250px">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">×</button>
								<h4 class="modal-title" id="myModalLabel"><strong>详情信息</strong></h4>
							</div>
							<div class="modal-body" id="detailInfoDiv" style='word-break:break-all;'>
							</div>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal -->
				</div>
		</div>
	</div>
	<!-- 新增编码 -->
	<div class="row">
		<div class="col-xs-12">
			<button class="btn btn-info" data-toggle="modal" type="button"
				style="display: none;" id="newProduct" data-target="#myModal03">
			</button>
			<form id="updateCode" class="form-horizontal" role="form" method='post' action="${request.contextPath}/match/ticket/commodity/addOrUpdate">
				<input type="hidden" id="_csrf" name="${_csrf.parameterName}"
								value="${_csrf.token}" />
				<div class="modal fade" id="myModal03" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal"
									aria-hidden="true">×</button>
								<h4 class="modal-title" id="myModalLabel">新增监控商品</h4>
							</div>
							<div class="modal-body">

								<div class="space-4"></div>
								<div class="form-group">
									<div class="col-sm-9">											 
									    <div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">监控编号</label>
											<div class="col-sm-7">
												<input type="text" id="monitorId" name="monitorId"
													placeholder="监控编号" class="form-control">
												<input type="hidden" id="id" name="id"
													class="form-control">
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
									    <div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">监控平台</label>

											<div class="col-sm-7">
												<input type="text" id="companyCode" name="companyCode"
													placeholder="监控平台" class="form-control">
											</div>
											<div style="color:red" class="remind" >*</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">监控景区 </label>

											<div class="col-sm-7">
												<input type="text" id="productName" name="productName"
													placeholder="监控景区" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">商品编号 </label>

											<div class="col-sm-7">
												<input type="text" id="commodityId" name="commodityId"
													placeholder="商品编号" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">商品名称</label>

											<div class="col-sm-7">
												<input type="text" id="commodityName" name="commodityName"
													placeholder="商品名称" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">商品价格</label>

											<div class="col-sm-7">
												<input type="text" id="price" name="price"
													placeholder="商品价格" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">驴妈妈ID</label>

											<div class="col-sm-7">
												<input type="text" id="lvCommodityId" name="lvCommodityId"
													placeholder="驴妈妈ID" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">采集网址</label>

											<div class="col-sm-7">
												<input type="text" id="productUrl" name="productUrl"
													placeholder="采集网址" class="form-control" >
											</div>
											<div style="color:red" class="remind">*</div>
										</div>
										
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">省份名称</label>

											<div class="col-sm-7">
												<input type="text" id="provinceCode" name="provinceCode"
													placeholder="省份名称" class="form-control" >
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">城市名称</label>

											<div class="col-sm-7">
												<input type="text" id="cityCode" name="cityCode"
													placeholder="城市名称" class="form-control" >
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">支付方式</label>

											<div class="col-sm-7">
												<input type="text" id="payMode" name="payMode"
													placeholder="支付方式" class="form-control" >
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-3 control-label no-padding-right"
												for="form-field-1">是否在线</label>

											<div class="col-sm-7">
												<input type="text" id="onlineStatus" name="onlineStatus"
													placeholder="是否在线" class="form-control" >
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-pink btn-sm"
									data-dismiss="modal">关闭</button>
								<button type="submit" class="btn btn-pink btn-sm" id="newMatchCommodity">
									提交</button>
							</div>
						</div>
						<!-- /.modal-content -->
					</div>
					<!-- /.modal -->
				</div>
			</form>
		</div>
	</div>
	<div class="col-xs-12" id="modalDiv">
		<div class="file-box">
			<form id="uploadForm">
			<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
			<div class="modal fade" id="myModalInput" tabindex="-1" role="dialog"
					aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-dialog">
								<div class="modal-content" style="width:400px; height:150px;">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"
											aria-hidden="true">×</button>
										<h4 class="modal-title" id="myModalLabel"><strong>产品导入</strong></h4>
									</div>
									<div class="modal-body" id="commodityUrlDetail" style='word-break:break-all;'>
										<input type='text' name='textfield' id='textfield' class='txt' />
										<input type='button' class='view' value='浏览...' />
										<input type="file" name="file" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" />
										<input type="button" onclick="uploadConfirm()" class="view" value="上传" id=""/>
									</div>
								</div>
								<!-- /.modal-content -->
						</div>
				</div>
			</form>
		</div> 
	</div>
	<input type="hidden" id="matchContext" value="${request.contextPath}"/>
	<script src="${request.contextPath}/static/assets/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="${request.contextPath}/static/javascripts/loading-incr.js"></script>
	<!-- page specific plugin scripts -->
	<script type="text/javascript" src="${request.contextPath}/static/javascripts/moment.js"></script>
	<script src="${request.contextPath}/static/assets/js/d3.v3.min.js"></script>
	<script type="text/javascript" src="${request.contextPath}/static/javascripts/daterangepicker.js"></script>
	<script src="${request.contextPath}/static/assets/js/bootbox.js"></script>
	<!-- ace scripts -->
	<script src="${request.contextPath}/static/assets/js/jquery.gritter.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/ace-elements.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/ace.min.js"></script>
	<!-- user scripts -->
	<script src="${request.contextPath}/static/assets/js/user/base.js"></script>
	<script src="${request.contextPath}/static/assets/js/moment.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/bootstrap-datepicker.min.js"></script>
	
	<script type="text/javascript">
		//d3.select(self.frameElement).style("height", "1150px");
		matchContext=$("#matchContext").val();
		$(document).ready(function() {
		    var url = window.location.href;
		    console.log(url);
		    if( url.indexOf('#') < 0 ) {
		        window.location.replace(url + "#");
		    } else {
		        window.location.replace(url);
		    }
		});
		
		var showDetailUrl=function(obj){
			url=$(obj).parent().parent().find("input.productUrl").val().trim();;
			$("#detailInfoDiv").text("");
			$("#detailInfoDiv").text(url);
			$("#detailInfo").click();
		}
		var showDetailCommodityName=function(obj){
			commodityName=$(obj).parent().parent().find("input.commodityName").val().trim();
			$("#detailInfoDiv").text("");
			$("#detailInfoDiv").text(commodityName);
			$("#detailInfo").click();
		}
		
		var skipToLinkPage=function(obj){
			id=$(obj).parent().find(".id").val().trim();
			lvCommodityId=$(obj).parents("tr").find(".lvCommodityId").text().trim();
			predelNameSearch=$("#QueryByCommodityName").val();
			productNameSearch=$("#QueryByProductName").val();
			commodityIdSearch=$("#QueryByCommodityId").val();
			companySearch=$("#QueryByCompany").val();
			$("#commodityLinkID").val(id);
			$("#lvmamaCommodityId").val(lvCommodityId);
			$("#commodityLinkRealID").val(commodityIdSearch);
			$("#companyCodeSearch").val(companySearch);
			$("#preNameSearch").val(predelNameSearch);
			$("#productNameSearch").val(productNameSearch);
			$("#commodityLinkButton").click();
		}
		
		function noCommodityMatch(obj){
			bootbox.confirm("<strong style='font-size:15px;'>确定没有可关联的驴妈妈商品吗？</strong>",function(result){
				if(result){
					 /*  竞品公司商品ID()  */
					 id=$(obj).parent().find(".id").val().trim();
					 var uuidValue = id;
		     	  	 $.ajax({  
				          url: "${request.contextPath}/match/ticket/commodity/rel/noCommodityMatch?commodityID="+uuidValue,  
				          type: 'GET',  
				          timeout: 12000,
				          async: false,  
				          cache: false,  
				          contentType: false,  
				          processData: false,
				          success: function (data) { 
				              if(data.Success!=null){
				            	  location.reload();
				            	  //bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){$('#returnToMatchPage').click()});
				              } 
				              //alert(data.inputError);
				              if(data.errorMessage!=null){
				            	  bootbox.alert("<strong style='padding-left:120px'>"+data.errorMessage+"</strong>",function(){location.reload();});
				              } 
				              
				          },  
				          error: function (data) {  
				        	  bootbox.alert("<strong style='padding-left:200px'>更新无商品关联操作失败</strong>",function(){location.reload();});  
				          }
				     });  
				     	  	
				}
			});
		}
		
		
		function matchCommodity()
		{
			openPartialLayer($("#loadingdiv"));
			
			setTimeout(function(){	
				$.ajax({  
			          url: matchContext+"/match/ticket/commodity/batchMatch",  
			          type: 'GET',  
			          timeout: 12000,
			          async: false,  
			          cache: false,  
			          contentType: false,  
			          processData: false,
			          success: function (data) { 
			        	  removeLoading($("#loadingdiv"));
			              if(data.Success!=null){
			            	  bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){location.reload()});
			              } 
			              //alert(data.inputError);
			              if(data.errorMessage!=null){
			            	  bootbox.alert("<strong style='padding-left:120px'>"+data.errorMessage+"</strong>",function(){location.reload()});
			              } 
			          },  
			          error: function (data) {  
			        	  removeLoading($("#loadingdiv"));
			        	  bootbox.alert("<strong style='padding-left:200px'>匹配失败</strong>",function(){location.reload()});  
			          }
			     });   
	     	  	},50)
			 
			
		}
		
		function uploadConfirm(){
			var formData = new FormData($("#uploadForm")[0]);  
		    if($("#fileField").val().length==0){
		    	bootbox.alert("<strong style='padding-left:200px'>文件名不能为空</strong>");
		    	return;
		    }
			bootbox.confirm("<strong style='font-size:15px;'>上传过程需一段时间且会删除您的历史数据，确定上传吗？</strong>",function(result){
				if(result){
					 var formData = new FormData($("#uploadForm")[0]);  
				     if($("#fileField").val().length==0){
				    	 bootbox.alert("<strong style='padding-left:200px'>文件名不能为空</strong>");
				    	 return;
				     }
				     if($(".fade")){
				    	 	$(".fade").css("display","none")
				      	  	openPartialLayer($("#loadingdiv"));
				     	  	setTimeout(function(){	
				     	  	 $.ajax({  
						          url: matchContext+"/match/ticket/commodity/importExcel",  
						          type: 'POST',  
						          data: formData,
						          timeout: 12000,
						          async: false,  
						          cache: false,  
						          contentType: false,  
						          processData: false,
						          success: function (data) { 
						        	  removeLoading($("#loadingdiv"));
						              if(data.Success!=null){
						            	  bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){location.reload()});
						              } 
						              //alert(data.inputError);
						              if(data.errorMessage!=null){
						            	  bootbox.alert("<strong style='padding-left:120px'>"+data.errorMessage+"</strong>",function(){location.reload()});
						              } 
						          },  
						          error: function (data) {  
						        	  removeLoading($("#loadingdiv"));
						        	  bootbox.alert("<strong style='padding-left:200px'>上传失败</strong>",function(){location.reload()});  
						          }
						     });  
				     	  	},50)
				     }	     
				}
				});
		}
		
		function cleanRelevance(){

			bootbox.confirm("<strong style='font-size:15px;'>清除后数据不可恢复，确定清除吗？</strong>",function(result){
				if(result){
					$.ajax({  
				          url: matchContext+"/match/ticket/commodity/cleanRelevance",  
				          type: 'GET',  
				          timeout: 12000,
				          async: false,  
				          cache: false,  
				          contentType: false,  
				          processData: false,
				          success: function (data) { 
				              if(data.Success!=null){
				            	  bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){location.reload()});
				              } 
				              if(data.errorMessage!=null){
				            	  bootbox.alert("<strong style='padding-left:120px'>"+data.errorMessage+"</strong>",function(){location.reload()});
				              } 
				          },  
				          error: function (data) {  
				        	  bootbox.alert("<strong style='padding-left:200px'>数据清除失败！</strong>",function(){location.reload()});  
				          }
				     });
				}
			});
		}
		
		function addNewCommodityItem(){
			$("#monitorId").val();
			$("#companyCode").val();
			$("#productName").val();
			$("#commodityId").val();
			$("#commodityName").val();
			$("#lvCommodityId").val();
			$("#price").val();
			$("#productUrl").val();
			$("#provinceCode").val();
			$("#cityCode").val();
			$("#payMode").val();
			$("#onlineStatus").val();
			$("#id").val();
		}
		function deleteCommodityItem(obj){
			var id=$(obj).parent().find(".id").val().trim();
			bootbox.confirm("<strong style='font-size:15px;padding-left:200px'>确认删除该条数据吗？</strong>", function(result){
				if(result){
					   $.ajax({
							url : matchContext+'/match/ticket/commodity/delete?id='+id,
							type : "GET",
							success: function (data) { 
					              if(data.Success!=null){
					            	  bootbox.alert("<strong style='padding-left:200px'>"+data.Success+"</strong>",function(){location.reload()});
					              } 
					              //alert(data.inputError);
					              if(data.errorMessage!=null){
					            	  bootbox.alert("<strong style='padding-left:120px'>"+data.errorMessage+"</strong>",function(){location.reload()});
					              } 
					              
					          },  
				          error: function (data) {  
				        	  bootbox.alert("<strong style='padding-left:200px'>删除失败</strong>",function(){location.reload()});  
				          }
						  }); 
						}
			})
		}
		$("#newMatchCommodity").click(function(){
			var i = 0;
			if($("#monitorId").val()==null || $("#monitorId").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>监控编号不能为空</strong>");
				return false;
			}
			if($("#companyCode").val()==null || $("#companyCode").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>监控平台不能为空</strong>");
				return false;
			}
			if($("#productName").val()==null || $("#productName").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>监控景区不能为空</strong>");
				return false;
			}
			if($("#commodityId").val()==null || $("#commodityId").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>商品编号不能为空</strong>");
				return false;
			}
			if($("#commodityName").val()==null || $("#commodityName").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>商品名称不能为空</strong>");
				return false;
			}
			
			if($("#price").val()==null || $("#price").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>商品价格不能为空</strong>");
				return false;
			}
			if($("#productUrl").val()==null || $("#productUrl").val()==""){
				bootbox.alert("<strong style='padding-left:200px'>专区URL不能为空</strong>");
				return false;
			}
			
		});
		
		$("#exportExcel").on("click",function(){
			$("#exportExcelForm").click();
		});
		var updateMatchCommodity=function(obj){
			monitorId=$(obj).parent().find(".monitorId").val().trim();
			companyCode=$(obj).parents("tr").find(".companyCode").text().trim();
			productName=$(obj).parents("tr").find(".productName").text().trim();
			commodityId=$(obj).parents("tr").find(".commodityId").text().trim();
			commodityName=$(obj).parent().find(".commodityName").val().trim();
			lvCommodityId=$(obj).parents("tr").find(".lvCommodityId").text().trim();
			price=$(obj).parents("tr").find(".price").text().trim();
			productUrl=$(obj).parent().find(".productUrl").val().trim();
			id=$(obj).parent().find(".id").val().trim();
			lvProductId=$(obj).parent().find(".lvProductId").val().trim();
			lvCommodityName=$(obj).parent().find(".lvCommodityName").val().trim();
			$("#monitorId").val(monitorId);
			$("#companyCode").val(companyCode);
			$("#productName").val(productName);
			$("#commodityId").val(commodityId);
			$("#commodityName").val(commodityName);
			$("#lvCommodityId").val(lvCommodityId);
			$("#price").val(price);
			$("#productUrl").val(productUrl);
			$("#id").val(id);
		}
	</script>
</body>
</html>